Contagion, Confounding, and Causality: Confronting the Three C's of Observational Political Networks Research. 
Uppala, Medha and Desmarais, Bruce A. 


The simulations and the Polity dataset application for the paper were run on a mid-2014 Macbook pro with 3GHz Dual core Intel Core i7 processor and 16 GB of RAM. The versions of R and R packages used are: 
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
sna_2.6
collapse_1.7.6
ergm_4.2.1 
ggplot2_3.3.6 
tseries_0.10-51 
punitroots_0.0-2  
dplyr_1.0.9  
tidyr_1.2.0 

The approximate time to run each R script and the sequence for running each R script is noted as a comment in "main.R" and "Appendix_main.R" scripts. 

Files/Folders in the Repository: 

Master.R: This script downloads the above mentioned R packages in the mentioned versions. It loads necessary packages to run both the Paper and Appendix R scripts. 

Paper: Contains all the R Scripts necessary to run the Shalizi Thomas test on data from different data generating processes. The RDS objects from these scripts are in the Data folder and are required to plot the images in the paper. Begin with "main.R" script. 
	This folder has the R Scripts that produce Figures 2a, 2b, 2c and 3 presented in the paper.

Appendix: Contains all the R Scrips necessary to replicate the data and produce the plots in the Appendix. Once again, the RDS objects produced by the R Scripts are in the Data folder. Begin with 'Appendix_main.R' script. 
	This folder has the R Scrips that produce Figures 1a, 1b, 1c, 2a, 2b, 2c and 3 presented in the Appendix of the paper. 

Data: This folder contains the RDS objects produced by running the R scrips in the Paper and Appendix folders. 

Plots: Contains all the plots produced by the R scripts in the Paper and Appendix folders. 

Packages: This folder contains the zipped folder for the punitroot_0.0-2 package. It is called from here and installed. 
